package com.hdhere.domain.common.data;

import org.hibernate.dialect.MySQL55Dialect;
import org.hibernate.dialect.MySQL5InnoDBDialect;

import java.sql.Types;

/**
 * Created by dus on 2018/11/4.
 */
public class MySQLDialect extends /*MySQL5InnoDBDialect*/MySQL55Dialect {

    @Override
    public String getTableTypeString() {
        return " ENGINE=InnoDB DEFAULT CHARSET=utf8";
    }

    public MySQLDialect() {

        super();

        /**
         * 往TypeNames中添加jsonb类型
         */
        this.registerColumnType(Types.JAVA_OBJECT, "json");

        /**
         * 防止无类型时报错 No Dialect mapping for JDBC type: 1111
         */
        this.registerHibernateType(Types.OTHER, "JsonUserType");

    }
}
